using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;


namespace DataHelper.BLL
{
    public class BK_Booking
    {
        public int ID { get; set; }
        public string SessionID { get; set; }
        public int Status { get; set; }
        public int TotalPrice { get; set; }
        public string FromCity { get; set; }
        public string ToCity { get; set; }
        public string FlightDepart { get; set; }
        public string FlightReturn { get; set; }
        public int Ways { get; set; }
        public int Amount { get; set; }
        public string Name { get; set; }
        public string Phone { get; set; }
        public string Address { get; set; }
        public string Email { get; set; }
        public string Note { get; set; }
        public string IP { get; set; }
        public DateTime CreatedDate { get; set; }
        public string UpdatedUser { get; set; }
        public DateTime UpdatedDate { get; set; }
        public string DeletedUser { get; set; }
        public DateTime DeletedDate { get; set; }
        public bool IsDeleted { get; set; }
        public string rTotal { get; set; }
        public string rCode { get; set; }

        #region BK_BookingSelectAll
        public static List<BK_Booking> BK_BookingSelectAll(string strSearch="",int top = 1, int bottom = 20, SqlTransaction ConnectionString = null)
        {
            IDataReader dr = DataHelper.DAL.BK_Booking.BK_BookingSelectAll(strSearch,top,bottom,ConnectionString);
            List<BK_Booking> BK_BookingList = new List<BK_Booking>();
            while(dr.Read())
            {
                BK_Booking myBK_Booking = new BK_Booking
                {
                    ID = !dr.IsDBNull(dr.GetOrdinal("ID")) ? (int)dr["ID"] : 0,
                    SessionID = !dr.IsDBNull(dr.GetOrdinal("SessionID")) ? (string)dr["SessionID"] : null,
                    Status = !dr.IsDBNull(dr.GetOrdinal("Status")) ? (int)dr["Status"] : 0,
                    TotalPrice = !dr.IsDBNull(dr.GetOrdinal("TotalPrice")) ? (int)dr["TotalPrice"] : 0,
                    FromCity = !dr.IsDBNull(dr.GetOrdinal("FromCity")) ? (string)dr["FromCity"] : null,
                    ToCity = !dr.IsDBNull(dr.GetOrdinal("ToCity")) ? (string)dr["ToCity"] : null,
                    FlightDepart = !dr.IsDBNull(dr.GetOrdinal("FlightDepart")) ? (string)dr["FlightDepart"] : null,
                    FlightReturn = !dr.IsDBNull(dr.GetOrdinal("FlightReturn")) ? (string)dr["FlightReturn"] : null,
                    Ways = !dr.IsDBNull(dr.GetOrdinal("Ways")) ? (int)dr["Ways"] : 0,
                    Amount = !dr.IsDBNull(dr.GetOrdinal("Amount")) ? (int)dr["Amount"] : 0,
                    Name = !dr.IsDBNull(dr.GetOrdinal("Name")) ? (string)dr["Name"] : null,
                    Phone = !dr.IsDBNull(dr.GetOrdinal("Phone")) ? (string)dr["Phone"] : null,
                    Address = !dr.IsDBNull(dr.GetOrdinal("Address")) ? (string)dr["Address"] : null,
                    Email = !dr.IsDBNull(dr.GetOrdinal("Email")) ? (string)dr["Email"] : null,
                    Note = !dr.IsDBNull(dr.GetOrdinal("Note")) ? (string)dr["Note"] : null,
                    IP = !dr.IsDBNull(dr.GetOrdinal("IP")) ? (string)dr["IP"] : null,
                    CreatedDate = !dr.IsDBNull(dr.GetOrdinal("CreatedDate")) ? (DateTime)dr["CreatedDate"] : DateTime.Now,
                    UpdatedUser = !dr.IsDBNull(dr.GetOrdinal("UpdatedUser")) ? (string)dr["UpdatedUser"] : null,
                    UpdatedDate = !dr.IsDBNull(dr.GetOrdinal("UpdatedDate")) ? (DateTime)dr["UpdatedDate"] : DateTime.Now,
                    DeletedUser = !dr.IsDBNull(dr.GetOrdinal("DeletedUser")) ? (string)dr["DeletedUser"] : null,
                    DeletedDate = !dr.IsDBNull(dr.GetOrdinal("DeletedDate")) ? (DateTime)dr["DeletedDate"] : DateTime.Now,
                    IsDeleted = !dr.IsDBNull(dr.GetOrdinal("IsDeleted")) ? (bool)dr["IsDeleted"] : false,
                    rTotal = !dr.IsDBNull(dr.GetOrdinal("rTotal")) ? (string)dr["rTotal"] : null,
                    rCode = !dr.IsDBNull(dr.GetOrdinal("rCode")) ? (string)dr["rCode"] : null
                };
                BK_BookingList.Add(myBK_Booking);
        }
        dr.Close();
        dr.Dispose();
        return BK_BookingList;
        }
        #endregion
        #region BK_BookingSelectRow
        public static BK_Booking BK_BookingSelectRow(int ID, SqlTransaction ConnectionString = null)
        {
            IDataReader dr = DataHelper.DAL.BK_Booking.BK_BookingSelectRow(ID, ConnectionString);
            BK_Booking bk_booking = null;

            if(dr.Read())
            {
                bk_booking= new BK_Booking
                {
                    ID = !dr.IsDBNull(dr.GetOrdinal("ID")) ? (int)dr["ID"] : 0,
                    SessionID = !dr.IsDBNull(dr.GetOrdinal("SessionID")) ? (string)dr["SessionID"] : null,
                    Status = !dr.IsDBNull(dr.GetOrdinal("Status")) ? (int)dr["Status"] : 0,
                    TotalPrice = !dr.IsDBNull(dr.GetOrdinal("TotalPrice")) ? (int)dr["TotalPrice"] : 0,
                    FromCity = !dr.IsDBNull(dr.GetOrdinal("FromCity")) ? (string)dr["FromCity"] : null,
                    ToCity = !dr.IsDBNull(dr.GetOrdinal("ToCity")) ? (string)dr["ToCity"] : null,
                    FlightDepart = !dr.IsDBNull(dr.GetOrdinal("FlightDepart")) ? (string)dr["FlightDepart"] : null,
                    FlightReturn = !dr.IsDBNull(dr.GetOrdinal("FlightReturn")) ? (string)dr["FlightReturn"] : null,
                    Ways = !dr.IsDBNull(dr.GetOrdinal("Ways")) ? (int)dr["Ways"] : 0,
                    Amount = !dr.IsDBNull(dr.GetOrdinal("Amount")) ? (int)dr["Amount"] : 0,
                    Name = !dr.IsDBNull(dr.GetOrdinal("Name")) ? (string)dr["Name"] : null,
                    Phone = !dr.IsDBNull(dr.GetOrdinal("Phone")) ? (string)dr["Phone"] : null,
                    Address = !dr.IsDBNull(dr.GetOrdinal("Address")) ? (string)dr["Address"] : null,
                    Email = !dr.IsDBNull(dr.GetOrdinal("Email")) ? (string)dr["Email"] : null,
                    Note = !dr.IsDBNull(dr.GetOrdinal("Note")) ? (string)dr["Note"] : null,
                    IP = !dr.IsDBNull(dr.GetOrdinal("IP")) ? (string)dr["IP"] : null,
                    CreatedDate = !dr.IsDBNull(dr.GetOrdinal("CreatedDate")) ? (DateTime)dr["CreatedDate"] : DateTime.Now,
                    UpdatedUser = !dr.IsDBNull(dr.GetOrdinal("UpdatedUser")) ? (string)dr["UpdatedUser"] : null,
                    UpdatedDate = !dr.IsDBNull(dr.GetOrdinal("UpdatedDate")) ? (DateTime)dr["UpdatedDate"] : DateTime.Now,
                    DeletedUser = !dr.IsDBNull(dr.GetOrdinal("DeletedUser")) ? (string)dr["DeletedUser"] : null,
                    DeletedDate = !dr.IsDBNull(dr.GetOrdinal("DeletedDate")) ? (DateTime)dr["DeletedDate"] : DateTime.Now,
                    IsDeleted = !dr.IsDBNull(dr.GetOrdinal("IsDeleted")) ? (bool)dr["IsDeleted"] : false,
                    rTotal = !dr.IsDBNull(dr.GetOrdinal("rTotal")) ? (string)dr["rTotal"] : null,
                    rCode = !dr.IsDBNull(dr.GetOrdinal("rCode")) ? (string)dr["rCode"] : null,

                };
            }
        dr.Close();
        dr.Dispose();
        return bk_booking;
        }
        #endregion
        #region BK_BookingInsertRow
        public static void BK_BookingInsertRow(int ID, string SessionID, int Status, int TotalPrice, string FromCity, string ToCity, string FlightDepart, string FlightReturn, int Ways, int Amount, string Name, string Phone, string Address, string Email, string Note, string IP, DateTime CreatedDate, string UpdatedUser, DateTime UpdatedDate, string DeletedUser, DateTime DeletedDate, bool IsDeleted, string rTotal, string rCode, SqlTransaction ConnectionString = null)
        {
            DataHelper.DAL.BK_Booking.BK_BookingInsertRow(ID, SessionID, Status, TotalPrice, FromCity, ToCity, FlightDepart, FlightReturn, Ways, Amount, Name, Phone, Address, Email, Note, IP, CreatedDate, UpdatedUser, UpdatedDate, DeletedUser, DeletedDate, IsDeleted, rTotal, rCode, ConnectionString);
        }
        #endregion
        #region BK_BookingUpdateRow
        public static void BK_BookingUpdateRow(int ID, string SessionID, int Status, int TotalPrice, string FromCity, string ToCity, string FlightDepart, string FlightReturn, int Ways, int Amount, string Name, string Phone, string Address, string Email, string Note, string IP, DateTime CreatedDate, string UpdatedUser, DateTime UpdatedDate, string DeletedUser, DateTime DeletedDate, bool IsDeleted, string rTotal, string rCode, SqlTransaction ConnectionString = null)
        {
            DataHelper.DAL.BK_Booking.BK_BookingUpdateRow(ID, SessionID, Status, TotalPrice, FromCity, ToCity, FlightDepart, FlightReturn, Ways, Amount, Name, Phone, Address, Email, Note, IP, CreatedDate, UpdatedUser, UpdatedDate, DeletedUser, DeletedDate, IsDeleted, rTotal, rCode, ConnectionString);
        }
        #endregion
        #region BK_BookingDeleteRow
        public static void BK_BookingDeleteRow(int ID, SqlTransaction ConnectionString = null)
        {
            DataHelper.DAL.BK_Booking.BK_BookingDeleteRow(ID,ConnectionString);
        }
        #endregion
    }
}
